/* Viewer Styles */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1f2937;
  background: #f9fafb;
}

.viewer-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.viewer-header {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-right {
  display: flex;
  gap: 12px;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  color: #4b5563;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.back-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

h1 {
  font-size: 24px;
  font-weight: 600;
  color: #1f2937;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #6366f1;
  color: white;
}

.btn-primary:hover {
  background: #4f46e5;
}

.btn-secondary {
  background: white;
  color: #4b5563;
  border: 1px solid #e5e7eb;
}

.btn-secondary:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

/* Main Content */
.viewer-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
}

/* Recording Info */
.recording-info {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.info-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.info-label {
  font-weight: 600;
  color: #6b7280;
  font-size: 13px;
}

.info-value {
  color: #1f2937;
  font-size: 14px;
}

.info-value a {
  color: #6366f1;
  text-decoration: none;
}

.info-value a:hover {
  text-decoration: underline;
}

/* Steps Container */
.steps-container {
  background: white;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Step Item */
.step-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 20px;
  overflow: hidden;
  transition: all 0.2s;
}

.step-item:hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.step-item.editing {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.step-header {
  display: flex;
  align-items: start;
  gap: 16px;
  padding: 20px;
  background: #f9fafb;
}

.step-number {
  width: 32px;
  height: 32px;
  background: #6366f1;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
  min-width: 0;
}

.step-action {
  font-size: 12px;
  font-weight: 600;
  color: #6366f1;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.step-description {
  font-size: 16px;
  color: #1f2937;
  line-height: 1.5;
}

.step-description.editable {
  border: 1px solid #e5e7eb;
  padding: 8px 12px;
  border-radius: 4px;
  background: white;
  outline: none;
  resize: vertical;
  min-height: 40px;
  width: 100%;
}

.step-description.editable:focus {
  border-color: #6366f1;
}

.step-meta {
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
}

.step-selector {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 3px;
}

.step-actions {
  display: flex;
  gap: 8px;
}

.step-action-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}

.step-action-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #4b5563;
}

.step-action-btn.delete:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

/* Step Screenshot */
.step-screenshot {
  padding: 0 20px 20px 20px;
}

.step-screenshot img {
  width: 100%;
  max-width: 800px;
  height: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
  cursor: pointer;
  transition: all 0.2s ease;
}

.step-screenshot img:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* 图片预览模态框 */
.image-preview-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 40px;
  backdrop-filter: blur(8px);
}

.image-preview-modal.show {
  display: flex;
}

.image-preview-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.image-preview-content img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s ease;
  cursor: grab;
  transform-origin: center;
}

.image-preview-content img:active {
  cursor: grabbing;
}

.image-preview-content img.zoomed {
  cursor: move;
  max-width: none;
  max-height: none;
}

/* 控制按钮容器 */
.preview-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 12px;
}

.preview-btn {
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.preview-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: translateY(-2px);
}

.preview-btn:active {
  transform: translateY(0);
}

/* 导航按钮 */
.navigation-controls {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  align-items: center;
}

.nav-btn {
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.nav-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.nav-btn:disabled:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: none;
}

/* 缩放控制 */
.zoom-controls {
  position: absolute;
  bottom: 30px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.zoom-btn {
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 18px;
  font-weight: 600;
}

.zoom-btn:hover {
  background: rgba(0, 0, 0, 0.9);
}

.zoom-info {
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  text-align: center;
  backdrop-filter: blur(10px);
}

.nav-info {
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(10px);
}

/* Loading State */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: #6b7280;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: #6366f1;
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
}

.close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.close-btn:hover {
  background: #f3f4f6;
  color: #4b5563;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Export Options */
.export-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.export-option {
  display: flex;
  align-items: start;
  gap: 12px;
  padding: 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.export-option:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}

.export-option input[type="radio"] {
  margin-top: 2px;
}

.export-option input[type="radio"]:checked + .option-content {
  color: #6366f1;
}

.export-option:has(input:checked) {
  border-color: #6366f1;
  background: #eef2ff;
}

.option-content {
  flex: 1;
}

.option-title {
  display: block;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
}

.option-desc {
  display: block;
  font-size: 13px;
  color: #6b7280;
}

/* Edit Toolbar */
.edit-toolbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px;
  display: none;
  gap: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.edit-toolbar.show {
  display: flex;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.toolbar-btn:hover {
  background: #f3f4f6;
}

.toolbar-btn:first-child {
  background: #6366f1;
  color: white;
}

.toolbar-btn:first-child:hover {
  background: #4f46e5;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #6b7280;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  color: #d1d5db;
}

/* Responsive */
@media (max-width: 768px) {
  .viewer-main {
    padding: 16px;
  }
  
  .recording-info {
    padding: 16px;
    gap: 16px;
  }
  
  .steps-container {
    padding: 16px;
  }
  
  .step-header {
    padding: 16px;
  }
  
  .step-screenshot {
    padding: 0 16px 16px 16px;
  }
  
  .modal-content {
    margin: 20px;
  }
}
